#ifndef RSA_MESSAGE_H
#define RSA_MESSAGE_H

#include <openssl/rsa.h>
#include "RSAKey.h"

namespace crypto
{
  namespace rsa
  {
    class RSAMessage {
      private:
        static const int MESSAGE_REST = 42;

        char *input;
        int inputLength;
        char *output;
        int outputLength;

      public:
        RSAMessage();
        ~RSAMessage();

        // set input data, which must be encoded or decoded
        void setInput(char *input, int inputLength);
        // get output data length
        // returns -1 on failure.
        int getOutputLength();
        // get output data
        // returns NULL on failure
        char * getOutput();
        // encrypts input to output using public key
        void encrypt(RSAKey *key);
        // decrypts input to output using private key
        void decrypt(RSAKey *key);
    };
  }
}

#endif
